<?php

namespace app\api\controller;
use think\Request;
use think\Config;
use think\Controller;
use app\index\model;
use think\Db;
use app\api\service\AdminuserService;

class Index{
	public function pndex(){

        $data = Db::table('basicinfo')
            ->where('id','>=',1)
            ->limit(3)
            ->select();
       // dump($data);
       //$result = Db::query('select * from zb_class where id = 3');
       // dump($result);

	   //dump(config());

	   //$user = model\Users::get(1);
       // Db::execute('update test_users set name="thinkphp" where usr_id=1 ');
       // $user->name     = 'thinkphp';
       // $user->addr    = 'thinkphp@qq.com';
       //$user->save();
        return $data;
	}
	/*
	public function getUserName($type='json'){
		if(!in_array($type, ['json','jsonp','xml'])){
			$type='json';
		}
		$res = [
			'code'  =>200,
			'result' =>[
				'list' =>[1,2,3,4,5],
				'grade'=>[10,90,1000]
			]
			];
		return $res;
	}
	public function index(Request $request){
		$res = [
			'code'  =>200,
			'result' =>[
				'list' =>[1,2,3,4,5]
			]
			];
		//Config::set('default_return_type','json');
		/*
		dump($request->param());
		$res = input('id');
		dump($request->get('id'));
		dump($res);
		*/
		//$request = request();
		//$request = Request::instance();
		/*
		dump($request->domain());
		dump($request->pathinfo());
		dump($request->path());

		#请求类型
		dump($request->method());

		#请求参数
		dump($request->get());
		dump($request->param('type'));

		#获取 模块 控制器 操作
		dump($request->module());
		dump($request->controller());
		dump($request->action());
		
		return $res;
	}
	
	public function info($name){
		echo url('api/index/info',['name'=>'huangwei'])."<br>";
		return "{$name}";
	}
	public function demo(){
		return "this is api Index demo";
	}*/
}